package com.lik.javadeep.offer.test03;

import java.util.Arrays;

/**
 * O(nlogn)
 */
public class T2 {
    private static class Solution {
        public int findRepeatNumber(int[] nums) {
            Arrays.sort(nums);
            int target = -1;
            for (int i = 0; i < nums.length; i++) {
                // 不相等
                int current = nums[i];
                if (target - current != 0) {
                   target = current;
                }else {
                    return target;
                }
            }
            // 没找到
            return -1;
        }
    }
}
